/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recanto.das.pedrinhas;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import recanto.das.pedrinhas.bean.Cliente;
import recanto.das.pedrinhas.controller.ClienteController;

/**
 *
 * @author Acesso Diego
 */
public class ControleReserva implements ActionListener{
    
    public static FrameReservaEtapa1 frameEtapa1 = new FrameReservaEtapa1();
    public static FrameReservaEtapa2 frameEtapa2 = new FrameReservaEtapa2();
    public static FrameReservaEtapa3 frameEtapa3 = new FrameReservaEtapa3();
    public static Cliente titular;
    public static ArrayList<Cliente> clientes = new ClienteController().retornaTitulares();
    
    
    public void setTitular(Cliente cliente){
        this.titular = cliente;
    }
    
    public Cliente getTitular(){
        return titular;
    } 
    @Override
    public void actionPerformed(ActionEvent e) {
        
        String command = e.getActionCommand();
        
        if (command.equals("ReservaEtapa1")) {
            frameEtapa1.recarregaInformações();
            frameEtapa1.setVisible(true);
            frameEtapa2.setVisible(false);
            frameEtapa3.setVisible(false);
        }
        
        else if (command.equals("ReservaEtapa2B")){
            frameEtapa2.modifica();
            frameEtapa2.limpaTabela();
            frameEtapa1.setVisible(false);
            frameEtapa2.setVisible(true);
            frameEtapa3.setVisible(false);
        }
        
        else if (command.equals("ReservaEtapa2A")){
            frameEtapa1.selecionaTitular();
            frameEtapa1.setVisible(false);
            frameEtapa2.setVisible(true);
            frameEtapa3.setVisible(false);
      
        }
        
         else if (command.equals("ReservaEtapa3")){
            frameEtapa2.setTitulares();
            frameEtapa1.setVisible(false);
            frameEtapa2.setVisible(false);
            frameEtapa3.setVisible(true);
        }
        
         else if (command.equals("ConcluirReserva")) {
             frameEtapa1.dispose();
             frameEtapa2.dispose();
             frameEtapa3.dispose();
         }
         
        
        
    }
  
    
}
